package com.ymatou.iapi.productquery.service;

import java.util.ArrayList;
import java.util.List;

import com.google.gson.reflect.TypeToken;
import com.ymatou.iapi.productquery.parameter.NewProductIdDto;
import com.ymatou.iapi.productquery.parameter.ProductInListDto;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*根据买手Id列表获取新品列表Call
*FreeMaker Template自动生成代码
*/
public class GetNewProductListBySellerIdListCall extends YmatouBaseCall{
	private static String opurl ="api/Product/GetNewProductListBySellerIdList";
	
	public GetNewProductListBySellerIdListCall() {
		super(EnvSetup.getSystemUrl("productquery"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public List<NewProductIdDto> getProductList()
    {
		List<NewProductIdDto> data = null;
        try {
        	String ProductList=getJsonObject().get("Data").getAsJsonObject().get("NewProductIdList").getAsJsonArray().toString();
        	data=(List<NewProductIdDto>) FormatUtil.GSONToObject(ProductList, new TypeToken<List<NewProductIdDto>>() {}.getType());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
}